<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<pre style="line-height: 100%;font-family:monospace;background-color:#ffffff; border-width:0.01mm; border-color:#000000; border-style:solid;padding:4px;font-size:10pt;"><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">h2</span><span style="background-color:#efefef;">&gt;</span><span style="background-color:#ffffff;">WSO2 Carbon Authentication Demo</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">h2</span><span style="background-color:#efefef;">&gt;
&lt;</span><span style="color:#000080;background-color:#efefef;">p</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">    This demo shows how to integrate your Web application with the Carbon authentication mechanism.
</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">p</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">&lt;%
    Object failed = request.getParameter("failed");
    if (failed != null) {
%&gt;
        </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">p</span><span style="background-color:#efefef;">&gt;&lt;</span><span style="color:#000080;background-color:#efefef;">font</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">color=</span><span style="color:#008000;background-color:#efefef;">"red"</span><span style="background-color:#efefef;">&gt;</span><span style="background-color:#ffffff;">Login Failed!</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">font</span><span style="background-color:#efefef;">&gt;</span><span style="background-color:#ffffff;"> </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">p</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">&lt;%
    }
%&gt;
&lt;%
   if (session.getAttribute("logged-in") != null) {
%&gt;
         </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">p</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">             Welcome &lt;%= session.getAttribute("username") %&gt;
         </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">p</span><span style="background-color:#efefef;">&gt;

</span><span style="background-color:#ffffff;">&lt;%
   } else {
       session.invalidate();
%&gt;
</span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">form</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">action=</span><span style="color:#008000;background-color:#efefef;">"login.jsp"</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">    </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">table</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;</span><span style="background-color:#ffffff;">Username</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;&lt;</span><span style="color:#000080;background-color:#efefef;">input</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">type=</span><span style="color:#008000;background-color:#efefef;">"text"</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">name=</span><span style="color:#008000;background-color:#efefef;">"username"</span><span style="background-color:#efefef;">/&gt;</span><span style="color:#0000ff;background-color:#ffffff;">&nbsp;</span><span style="background-color:#ffffff;"> username@domain format</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;</span><span style="background-color:#ffffff;">Password</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;&lt;</span><span style="color:#000080;background-color:#efefef;">input</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">type=</span><span style="color:#008000;background-color:#efefef;">"password"</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">name=</span><span style="color:#008000;background-color:#efefef;">"password"</span><span style="background-color:#efefef;">/&gt;&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">colspan=</span><span style="color:#008000;background-color:#efefef;">"2"</span><span style="background-color:#efefef;">&gt;</span><span style="color:#0000ff;background-color:#ffffff;">&nbsp;</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;</span><span style="color:#0000ff;background-color:#ffffff;">&nbsp;</span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">            </span><span style="background-color:#efefef;">&lt;</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;&lt;</span><span style="color:#000080;background-color:#efefef;">input</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">type=</span><span style="color:#008000;background-color:#efefef;">"submit"</span><span style="background-color:#efefef;"> </span><span style="color:#0000ff;background-color:#efefef;">value=</span><span style="color:#008000;background-color:#efefef;">"Login"</span><span style="background-color:#efefef;">/&gt;&lt;/</span><span style="color:#000080;background-color:#efefef;">td</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">        </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">tr</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">    </span><span style="background-color:#efefef;">&lt;/</span><span style="color:#000080;background-color:#efefef;">table</span><span style="background-color:#efefef;">&gt;
&lt;/</span><span style="color:#000080;background-color:#efefef;">form</span><span style="background-color:#efefef;">&gt;
</span><span style="background-color:#ffffff;">&lt;%
   }
%&gt;</span></pre>